<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title th:text="${session.coursesv.courseName}"></title>
    <link rel="stylesheet" href="../../static/Semantic-UI-master/dist/semantic.min.css" th:href="@{/Semantic-UI-master/dist/semantic.min.css}">
    <link rel="stylesheet" href="../../static/css/custom.css" th:href="@{/css/custom.css}">
</head>
<body>
<nav class="ui attached segment m-padded-tb-mini">
    <div class="ui container">
        <div class="ui menu secondary font-size-middle font-y-center">

                <span class="ui teal header item">
                <img src="../../static/imges/1.png" th:src="@{/imges/1.png}" class="image-size-mini"/>
                </span>
            <a class="item" th:href="@{/}"><i class="home icon"></i>首页</a>
            <a class="item" href="syclass.html" th:href="@{/sy/syuser/syclass}"><i class="building icon"></i>sy课堂</a>
            <a class="item" href="aboutwe.html" th:href="@{/sy/syuser/aboutwe}"><i class="info icon"></i>关于我们</a>

            <div class="item right" th:if="${session.User}">
                <div class="ui simple dropdown">
                    <img class="ui avatar image dropdown" src="../static/imges/user.jpg" th:src="${session.User.userImg}">
                    <span th:text="${session.User.userName}"></span>
                    <div class="menu">
                        <a href="User/userPC.html" th:href="@{/sy/syuser/gopc}" class="item"><i class="user circle icon"></i>个人主页</a>
                        <a href="User/userPC.html" th:href="@{/sy/syuser/gopc}" class="item"><i class="edit outline icon"></i>管理中心</a>
                        <a href="/sy/syuser/logout" class="item"><i class="sign out alternate icon"></i>退出登录</a>
                    </div>
                </div>
            </div>


        </div>

    </div>
</nav>
<!--中间内容 左侧导航栏（课件+作业），右侧为课件内容or作业-->
<div class="ui container">
    <div class="ui grid">
        <!--  左侧导航栏  -->
        <div class="five wide column slide">
            <div class="ui link list segment" style="height: 500px">
                <div class="active item m-padded-tb-middle font-x-center">
                    <img class="image-size-ll ui image" th:src="${session.coursesv.courseImge}" src="../../static/imges/timg.jpg">
                </div>
                <a class="item" href="courseware.html" th:href="@{/sy/video/goware}"><button class="fluid ui button teal m-padded-tb-middle" id="xinxi">课件</button></a>
                <a class="item" href="#" th:href="@{/sy/homework/gohomework(courseid=${session.coursesv.courseId})}"><button class="fluid ui button teal m-padded-tb-middle" id="kecheng">作业</button></a>
                <a class="item" th:href="@{/sy/comment/gocomment(courseid=${session.coursesv.courseId})}"><button class="fluid ui button teal active m-padded-tb-middle">评论区</button></a>
            </div>
        </div>
        <!--   右侧内容 -->
        <div class="eleven wide column" id="pc_classp">
            <div class="ui segment font-x-center m-padded-b-mini" id="pc_page">
                <div class="ui">


                <div class="ui secondary pointing menu" id="father1">

                    <a class="item active xuanzhong1" id="qiehuan1">发起新的主题</a>
                </div>


                <!--       文本编辑器     -->
                <div class="field commenttext">
                    <textarea class="fieldchlid" id="fieldchlid" placeholder="我也来评论......" name="content"></textarea>
                </div>
                <div class="ui">
                    <div class="ui relaxed items">
                        <div class="item ui">
                            <div class="middle left"></div>
                            <div class="middle content"></div>
                            <div class="middle right">
                            <div class="middle right">
                                <button class="ui button teal" id="weizhi" disabled="disabled" href="javascript:void(0)" onclick="buildbuild();">发表回复</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

</body>
<script src="../../static/js/jquery-1.12.4.min.js" th:src="@{/js/jquery-1.12.4.min.js}"></script>
<script src="../../static/js/jquery-ui.min.js" th:src="@{/js/jquery-ui.min.js}"></script>
<script src="../../static/Semantic-UI-master/dist/semantic.min.js" th:src="@{/Semantic-UI-master/dist/semantic.min.js}"></script>
<script src="../../static/js/sy.min.js" th:src="@{/js/sy.min.js}"></script>
<script type="text/javascript">
    $("#fieldchlid").bind('input propertychange',function () {
        $("#weizhi").removeAttr("disabled");
    })


    function buildbuild() {
        const text = $("#fieldchlid").val();
        if(text==='' || text==null){
            return;
        }
        $.ajax({
            type: 'get',
            cache: false,
            url: '/sy/comment/addcomment',
            data: {'commentP':text},
            contenType: 'application/json;charset=utf-8',
            success: function(data){

                window.location.replace(data);
            },
            error: function(message){
                alert("出错了")
            }
        })
    }


</script>
</html>